Skip to content

chore: sync develop to main — PostHog migration verification - #204

Merged
ayoub3bidi merged 8 commits into
mainfrom
develop
Jul 18, 2026
Merged

chore: sync develop to main — PostHog migration verification#204
ayoub3bidi merged 8 commits into
mainfrom
develop

Conversation

@ayoub3bidi

Copy link
Copy Markdown
Owner

Contribution workflow

  • Base branch is main: This PR merges develop into main for PostHog migration verification.
  • Guidelines and docs: All changes have been reviewed through PRs targeting develop with full CI gates.
  • This template: Filled in below.

Description

Production sync — pushing PostHog analytics migration and agent readiness updates to main to verify the Umami → PostHog migration works in production.

8 commits across 3 merged PRs (#201#203), touching analytics infrastructure and agent discovery.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🔧 Chore (maintenance, dependencies, etc.)
  • 📚 Documentation update
  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🎨 Style/UI improvement
  • ⚡ Performance improvement
  • 🧪 Test addition or improvement

Related Issues

Supersedes PRs #201#203 merged into develop.

Changes Made

PostHog Analytics Migration (PR #203)

  • Migrated from Umami to PostHog for SaaS product analytics
  • Added PostHog proxy via Cloudflare Worker (worker/posthog-proxy.js) to bypass ad-blockers
  • Implemented PostHogProvider with lazy initialization and feature flag support
  • Created analytics.js service layer and analyticsEvents.js event catalog
  • CSP updates for PostHog ingestion endpoints
  • Dev-mode bypass for local analytics testing

Agent Readiness (PRs #201#202)

  • Added .well-known/agent-card.json, MCP server card, and API catalog for AI agent discovery
  • RFC 9727 Link headers for REST API discoverability
  • Markdown content negotiation for /llms.txt and /auth.md
  • OAuth authorization server metadata for agent authentication flows
  • Addressed CodeRabbit review: CORS hardening, Footer placement

Testing

  • All existing tests pass (pnpm test:run)
  • New tests added for new functionality
  • Manual testing completed
  • Cross-browser testing (if UI changes)

Test Results

All PRs were gated by CI (lint → format → test:coverage → build) before merge to develop.

Code Quality

  • Code follows the project's coding standards
  • ESLint passes (pnpm lint)
  • Prettier formatting applied (pnpm format)
  • No console errors or warnings
  • Code is properly documented with JSDoc (if applicable)

Performance Impact

  • No performance impact

Accessibility

  • Keyboard navigation works correctly
  • Screen reader compatibility maintained
  • Color contrast meets WCAG guidelines
  • Focus indicators are visible

Breaking Changes

  • None

Checklist

  • I have completed the Contribution workflow checklist at the top of this template
  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

This is a targeted production sync to verify the PostHog analytics migration works end-to-end in production. v0.5.0 development continues on develop.

PRs included in this merge:

PR Title Category
#201 Agent readiness — discovery files, MCP, OAuth Feature
#202 Agent readiness — Link headers, A2A compliance Feature
#203 Migrate from Umami to PostHog analytics Feature

Post-deployment verification checklist:

  • PostHog events firing on bayanflow.com
  • PostHog proxy endpoint responding (/ph/...)
  • No CSP violations in production console
  • Feature flags accessible via PostHog

Reviewer Guidelines:

  • Check that all tests pass
  • Verify code follows project standards
  • Test the changes locally
  • Review for security implications
  • Ensure documentation is updated

…rver card, OAuth discovery, and llms.txt

- Add Link response headers for agent discovery (RFC 8288): api-catalog,
  oauth-protected-resource, mcp-server-card, auth-md, llms-txt
- Rewrite .well-known/api-catalog to RFC 9727 linkset+json format
- Create .well-known/mcp/server-card.json with serverInfo schema (SEP-1649),
  replacing old .well-known/mcp.json
- Add .well-known/oauth-authorization-server referencing Supabase issuer
- Add .well-known/oauth-protected-resource (RFC 9728)
- Add /llms.txt machine-readable site description for AI agents
- Fix auth.md heading to match Auth.md standard
- Add CORS Access-Control-Allow-Origin: * on all .well-known/* paths
- Add <main> wrapper to LandingPage for semantic HTML
- Document manual Cloudflare steps: DNS-AID records + Markdown for Agents
feat(agent-readiness): make Bayan Flow discoverable and usable by AI agents
…ompliance

- Add service-desc, service-doc, describedby Link headers (RFC 8288)
- Update api-catalog Content-Type with RFC 9727 profile parameter
- Add A2A required fields to agent-card.json (version, skills, supportedInterfaces)
- Create .well-known/mcp.json at scanner-expected path
- Add Cloudflare Worker for Accept: text/markdown content negotiation
- Add markdown summary files for all public pages
- Update wrangler.jsonc with Worker entry point and assets binding
feat: Agent readiness — Link headers, markdown negotiation, A2A/MCP compliance
…tics

- Replace Umami with PostHog SDK (posthog-js, @posthog/react)
- Add PostHog reverse proxy via e.bayanflow.com (ad-blocker resilient)
- Instrument 20+ custom events across VisualizerApp, UserMenu, SignInPromptModal, useFavorites, useNoteAutosave
- Implement user identification on sign-in/sign-out via AuthProvider
- Add first-party session replay (text/media masked, inputs masked)
- Respect Do Not Track header
- Add feature flag architecture for future use
- Update CSP headers for PostHog domains
- Update privacy policy, SECURITY.md to reference PostHog
- Add VITE_POSTHOG_API_KEY/VITE_POSTHOG_API_HOST to CI workflows
…cache guards, dev bypass

- deploy-cloudflare.yml: use branch-conditional proxy host (e.bayanflow.com for main, e.dev.bayanflow.com for develop)
- public/_headers: add e.bayanflow.com and e.dev.bayanflow.com to connect-src
- scripts/cspHeaders.js: exact token matching instead of substring includes; add proxy origin check
- worker/index.js: accept both staging and production proxy domains; restrict static-asset cache to GET
- worker/posthog-proxy.js: restrict static-asset cache to GET
- src/services/analytics.js: set isBypassed flag to prevent SDK event queueing in dev
- src/contexts/AuthProvider.jsx: identifyUser after profile fetch with accurate plan
- .env.example: alphabetical ordering of PostHog env vars
feat(analytics): migrate from Umami to PostHog for SaaS product analytics
@github-actions github-actions Bot added documentation Improvements or additions to documentation style Improve styling, design, and animation ci Workflows dependencies tests labels Jul 18, 2026
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ff1dcf4-5a0b-47c3-a98b-0bfc7c2c34f8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.56250% with 59 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
worker/posthog-proxy.js 2.32% 42 Missing ⚠️
src/services/featureFlags.js 12.50% 7 Missing ⚠️
src/providers/PostHogProvider.jsx 14.28% 6 Missing ⚠️
src/pages/VisualizerApp.jsx 88.88% 3 Missing ⚠️
src/contexts/AuthProvider.jsx 94.44% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ayoub3bidi
ayoub3bidi merged commit ecaf7ce into main Jul 18, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Workflows dependencies documentation Improvements or additions to documentation style Improve styling, design, and animation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant